package com.hc.acoustics.bmob;

import android.hardware.usb.UsbDevice;
import android.util.Log;

import com.yc.yclibrary.exception.ApiException;

import java.util.List;

import cn.bmob.v3.BmobQuery;
import cn.bmob.v3.exception.BmobException;
import cn.bmob.v3.listener.FindListener;
import cn.bmob.v3.listener.QueryListener;

/**
 *
 */
public class BmobHelper {
    public static void getVersionData(IBmobNet<BmobVersionBean> iBmobNet) {
        BmobQuery<BmobVersionBean> query = new BmobQuery<BmobVersionBean>();
        query.setLimit(1).findObjects(new FindListener<BmobVersionBean>() {
            @Override
            public void done(List<BmobVersionBean> list, BmobException e) {
                if (e == null) {
                    iBmobNet.success(list.get(0));
                } else {
                    iBmobNet.fail(new ApiException(e.getMessage(), e.getErrorCode()));
                }
            }
        });
    }
}
